package com.haixiaoke.task;

import com.haixiaoke.saas.lock.service.IDeviceLockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author Panda
 * @Date 2025/4/17
 **/
@Component
public class DeviceLockTask {

    @Autowired
    private IDeviceLockService deviceLockService;

    /**
     * 电量同步任务--0点开始每隔两小时执行一次
     */
    @Scheduled(cron = "0 0 0/2 * * ?")
    public void batterySyncTask() {
        deviceLockService.batterySyncTask();
    }

    /**
     * 在线状态同步任务--晚上3点执行一次
     */
    @Scheduled(cron = "0 0 3 * * ?")
    public void onlineStatusSyncTask() {
        deviceLockService.onlineStatusSyncTask();
    }
}
